package com.ctshk.sapp.order.scenic.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.order.scenic.req.AirshowOrderCancelHandleReq;
import com.ctshk.rpc.order.scenic.req.AirshowOrderCancelReq;
import com.ctshk.rpc.order.scenic.req.AirshowOrderListReq;
import com.ctshk.rpc.order.scenic.service.IAirshowOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/airshow-order-platform")
@Api(value="珠海航展云平台订单服务", tags="珠海航展云平台订单服务")
public class AirshowOrderPlatformController extends BaseController {

    @DubboReference
    private IAirshowOrderService iAirshowOrderService;

    @ApiOperation(value = "珠海航展-云平台查询订单列表", notes = "珠海航展-云平台查询订单列表")
    @PostMapping(value = "/get-platform-order-list-by-params")
    public Result getPlatformOrderListByParams(@RequestBody AirshowOrderListReq airshowOrderListReq){
        return iAirshowOrderService.getPlatformOrderListByParams(airshowOrderListReq,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "珠海航展-云平台订单发起退票申请", notes = "珠海航展-云平台订单发起退票申请")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.UPDATE, operTitle = "珠海航展-云平台订单发起退票申请", operDesc = "珠海航展-云平台订单发起退票申请")
    @PostMapping(value = "/platform-cancel-order-by-id")
    public Result platformCancelOrderById(@RequestBody AirshowOrderCancelReq airshowOrderCancelReq){
        return iAirshowOrderService.platformCancelOrderById(airshowOrderCancelReq,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "珠海航展-通过订单ID查询订单", notes = "珠海航展-通过订单ID查询订单")
    @PostMapping(value = "/get-order-by-id")
    public Result getOrderById(Long id){
        return iAirshowOrderService.getOrderById(id);
    }

    @ApiOperation(value = "珠海航展-云平台处理退款申请", notes = "珠海航展-云平台处理退款申请")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.UPDATE, operTitle = "珠海航展-云平台处理退款申请", operDesc = "珠海航展-云平台处理退款申请")
    @PostMapping(value = "/platform-handle-order-apply")
    public Result platformHandleOrderApply(@RequestBody AirshowOrderCancelHandleReq airshowOrderCancelHandleReq){
        return iAirshowOrderService.platformHandleOrderApply(airshowOrderCancelHandleReq);
    }


}
